/* eslint-disable prefer-const */
/*
 * @Author: 李琪 liqi@lark2game.com
 * @Date: 2025-04-15 20:21:20
 * @LastEditors: 李琪 liqi@lark2game.com
 * @LastEditTime: 2025-05-07 11:55:44
 * @FilePath: /cocosBehavior/assets/Script/Helloworld.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const { ccclass, property } = cc._decorator;

@ccclass
export default class Helloworld extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    @property
    text: string = 'hello';

    start() {
        // init logic
        this.label.string = this.text;
    }
    onbtnFsmStoryClicked() {
        /**创建一个fsmStory的预制体*/
        cc.resources.load("prefab/fsmStory", cc.Prefab, (err, prefab) => {
            if (err) {
                cc.error(err);
                return;
            }
            const res = prefab as cc.Prefab;
            let node = cc.instantiate(res);
            this.node.addChild(node);
        })
    }
    onbtnStoryClicked() {
        cc.resources.load("prefab/story", cc.Prefab, (err, prefab) => {
            if (err) {
                cc.error(err);
                return;
            }
            const res = prefab as cc.Prefab;
            let node = cc.instantiate(res);
            this.node.addChild(node);
        })

    }
}
